#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <assert.h>
#include <unistd.h>
int main(int argc,char* argv[])
 {
   printf("process is running...\n");

    pid_t id=fork();
    if(id==0)
    {
      sleep(1);
     // int cnt=10;
      //execl("/usr/bin/ls","ls","-a","-l","--color=auto",NULL);
      //execlp("ls","ls","-a","-l","--color=auto",NULL//);
    execvp(argv[1],&argv[1]);
     // char *const argv_[]= {
     // "ls",
     // "-l",
     // "-a",
     // "--color=auto",
     // NULL

     // };
     // //execv("/usr/bin/ls",argv_);
     // execvp("ls",argv_);
      exit(10);//must failed
    }//
    int status=0;
    pid_t ret=waitpid(id,&status,0);
    if(ret>0)printf("wait success: exit code :%d , sig: %d\n",(status>>8)& 0xff,status& 0x7f);
    return 0;
}

